<template>
	<!-- 回收详情(回收员) -->
	<view class="orderDetail">
		<view class="orderDetail-main">
			<!-- 已回收 -->
			<view class="recycled" v-if="pageId==2">
				<view class="recycled-branch">
					<text class="line">————</text>
					<text class="recycle-text">实际回收</text>
					<text class="line">————</text>
				</view>
				<view class="recycled-main">
					<view class="recycledMain-content" v-for="(item ,index) in orderDetail.actual" :key="index">
						<view class="recycledMain-title">{{item.firstVal}}，{{item.secondVal}}</view>
						<view class="recycledMain-count">
							<text class="recycledMain-number">数量：{{item.number}}{{item.unit}}</text>
							<text>回收币：{{item.price}}</text>
						</view>
					</view>
				</view>
				<view class="recycled-branch">
					<text class="line">————</text>
					<text class="recycle-text">客户信息</text>
					<text class="line">————</text>
				</view>
			</view>
			<view class="complete">
				<view class="main-content">
					<view class="content-text">联系人</view>
					<view class="content-right">{{orderDetail.consignee}}</view>
				</view>
				<view class="main-content">
					<view class="content-text">手机号码</view>
					<view class="content-right">{{orderDetail.consignee_phone}}</view>
				</view>
			</view>
			<view class="main">
				<view class="main-content">
					<view class="content-text">预约时间</view>
					<view class="content-right">{{orderDetail.reservetime}}</view>
				</view>
				<view class="main-content">
					<view class="content-text">上门地址</view>
					<view class="addressinfo">
						<view class="addressinfo-text">{{orderDetail.address}}</view>
						<view class="addressinfo-look" @tap="query_address"><text
								class="icon iconfont icon-weizhi"></text>查看位置</view>
					</view>
				</view>
				<view class="main-content">
					<view class="content-text">回收类型</view>
					<view class="content-right">{{orderDetail.type}}</view>
				</view>
				<view class="main-img" v-if="orderDetail.pic_url.length!=0">
					<view class="content-text">上传照片</view>
					<view class="uploadImg">
						<view class="uploadImg-box" v-for="(item,index) in orderDetail.pic_url" :key="index">
							<image :src="item" mode="aspectFill"></image>
						</view>
					</view>
				</view>
				<view class="main-content">
					<view class="content-text">分配时间</view>
					<view class="content-right">{{orderDetail.receivetime}}</view>
				</view>
				<view class="main-content">
					<view class="content-text">订单编号</view>
					<view class="content-right">{{orderDetail.logno}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import util from '../../component/commen/api/util';
	export default {
		data() {
			return {
				orderDetailId: "", //订单详情id
				orderDetail: {
					pic_url:[],
				}, //订单详情数据
				orderType: "", //类型
				pageId:"",//页面id
			};
		},
		onLoad(e) {
			console.log("页面id",e.orderId)
			this.pageId = e.orderId
			console.log("订单id",e.orderDetailId)
			this.orderDetailId = e.orderDetailId
		},
		onShow() {
			this.getDataDetail()
		},
		methods:{
			getDataDetail(){
				var params = {
					do:"reserve",
					op:"orderDetail",
					id:this.orderDetailId
				}
				util.requestWithSign(params).then(res=>{
					console.log("订单详细数据",res)
					this.orderDetail = res.data
				})
			},
			query_address() {
				uni.openLocation({
					latitude: Number(this.orderDetail.lat),
					longitude: Number(this.orderDetail.lng),
					address: this.orderDetail.address,
					scale: 18,
					success: function(e) {
						console.log("success", e);
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.orderDetail {
	padding-bottom: 30rpx;
		.orderDetailheader {
			width: 100%;
			padding: 20rpx 0;
			background: #00b388;
			color: #fff;
			text-align: center;
			font-size: 26rpx;
			font-weight: bold;
		}

		.orderDetail-main {
			padding: 0 20rpx;
			.recycled{
				.recycled-branch{
					margin-top: 20rpx;
					text-align: center;
					.line{
						color: #f3f2f2;
					}
					.recycle-text{
						color: #8b8a8a;
					}
				}
				.recycled-main{
					margin-top: 20rpx;
					font-size: 28rpx;
					.recycledMain-content{
						background: #fff;
						// border-radius: 20rpx;
						padding: 30rpx;
						border-bottom: 2rpx solid #f3f2f2;
						box-sizing: border-box;
						.recycledMain-title{
							font-weight: bold;
						}
						.recycledMain-count{
							margin-top: 20rpx;
							font-size: 25rpx;
							.recycledMain-number{
								display: inline-block;
								margin-right: 20rpx;
							}
						}
					}
				}
			}
			.complete{
				margin-top: 20rpx;
				padding: 20rpx 40rpx;
				box-sizing: border-box;
				background: #fff;
				border-bottom: 2rpx solid #f7f7f7;
				border-radius: 20rpx 20rpx 0 0;
				.main-content{
					display: flex;
					// margin-top: 20rpx;
					padding: 30rpx 0;
					.content-text {
						font-size: 26rpx;
						width: 30%;
						color: #747373;
						// border: 1px solid #00b388;
						// margin-right: 70rpx;
					}
					
					.content-right {
						font-size: 26rpx;
						font-weight: bold;
						width: 70%;
						// border: 1px solid #f00;
					}
				}
			}
			.main {
				// margin-top: 20rpx;
				padding: 20rpx 40rpx;
				box-sizing: border-box;
				background: #fff;
				// border-radius: 20rpx;

				.main-content {
					display: flex;
					// margin-top: 20rpx;
					padding: 30rpx 0;

					.content-text {
						font-size: 26rpx;
						width: 30%;
						color: #747373;
						// border: 1px solid #00b388;
						// margin-right: 70rpx;
					}

					.content-right {
						font-size: 26rpx;
						font-weight: bold;
						width: 70%;
						// border: 1px solid #f00;
					}

					.addressinfo {
						.addressinfo-text {
							font-size: 26rpx;
							font-weight: bold;
						}

						.addressinfo-look {
							margin-top: 10rpx;
							font-size: 25rpx;
							color: #00b388;
						}
					}
				}

				.main-img {
					.content-text {
						color: #8b8a8a;
					}

					.uploadImg {
						display: flex;
						flex-wrap: wrap;

						.uploadImg-box {
							margin: 20rpx 10rpx;
							width: 200rpx;
							height: 100rpx;

							image {
								width: 100%;
								height: 100%;
							}
						}
					}
				}
			}
		}
	}
</style>
